﻿<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>代垫拒绝</title>
    <link rel="stylesheet" type="text/css" href="../Content/Css/OperaMasksUI/default/om-all.css" />
    <link rel="stylesheet" type="text/css" href="../Content/Css/list.css" />
    <script type="text/javascript" src="../Scripts/jquery.1.6.3.min.js"></script>
    <script type="text/javascript" src="../Scripts/json2.js"></script>
    <script type="text/javascript" src="../Scripts/common.js"></script>
    <script type="text/javascript" src="../Scripts/OperaMasksUI/operamasks-ui.min.js"></script>
    <script type="text/javascript" src="../Scripts/Plugin/jquery.form.js"></script>
    <script type="text/javascript" src="../Scripts/Plugin/artDialog4.1.7/jquery.artDialog.js?skin=default"></script>
    <script type="text/javascript" src="../Scripts/Plugin/artDialog4.1.7/plugins/iframeTools.js"></script>
    <script type="text/javascript" src="../Scripts/banBackSpace.js"></script>
    <script type="text/javascript">
        var validatorForm, submitForm, detailForm;
        var actionRoot = "../handler/ajax.ashx?type=AjaxSystem" ;

        $(document).ready(function () {
            detailForm = $('#viewForm');
            validatorForm = $('#viewForm').validate({
                errorContainer: "#errorMessages",
                errorLabelContainer: "#errorMessages",
                wrapper: "span",
                errorClass: "omError",
                rules: {
                    RejectNote: { required: true }
                },
                messages: {
                    RejectNote: { required: "[拒绝理由]不能为空" }
                }
            });
            $('span#button-save', detailForm).omButton({
                icons: { left: '../Content/Images/List/accept.png' }, width: 80,
                onClick: function () {
                    if (validatorForm.form()) {
                        $.ajax({
                            cache: false, async: false,
                            url: '../handler/ajax.ashx?type=AjaxSystem&method=DoInsteadReject',
                            dataType: 'json', type: 'post',
                            data: { UID: art.dialog.data('UID'), VERB: art.dialog.data('verb'), REJECTNOTE: $("#RejectNote").html(), USERID: art.dialog.data('currentUID') },
                            beforeSend: function () {
                                $.omMessageBox.waiting({
                                    title: '请等待',
                                    content: '系统正在提交,请稍后...'
                                });
                            },
                            complete: function () {
                                $.omMessageBox.waiting("close");
                            },
                            success: function (data) {
                                if (data.IsError) {
                                    $.omMessageBox.alert({
                                        content: '错误：' + data.Message
                                    });
                                }
                                else {
                                    $.omMessageBox.alert({
                                        content: data.Message,
                                        onClose: function () {
                                            art.dialog.close();
                                        }
                                    });
                                }
                            },
                            error: function (result) {
                                $.omMessageBox.waiting("close");
                            }
                        });
                    }
                }
            });
            $('span#button-cancel', detailForm).omButton({
                icons: { left: '../Content/Images/List/cross.png' }, width: 80,
                onClick: function () {
                    art.dialog.close();
                }
            });
        });
    </script>
</head>
<body>
    <div id="center-panel">
        <div id="detail-form">
            <form id="viewForm">
                <div id="errorMessages" class="error"></div>
                <table>
                    <tr>
                        <td align="right" style="width: 80px; margin-left: 10px; color: red;">拒绝原因</td>
                        <td><textarea name="RejectNote" id="RejectNote" style="overflow: auto; border: 1px solid #A4BED4; width: 300px; height: 80px;"></textarea></td>                
                    </tr>
                    <tr>
                        <td align="center" colspan="4">
                        <span id="button-save">确认</span>
                        <span id="button-cancel">取消</span>
                    </td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
</body>
</html>
